if exists (select 1 from sysobjects where name = 'set_terminplan' and type = 'P')
begin
   drop procedure set_terminplan
   print 'Procedure: set_terminplan deleted ...'
end
go
create procedure set_terminplan(
   @planterminid   int  = 1,
   @planID         int  = 1,
   @prsID          int  = 1,
   @name           varchar(32) = 'Erster',
   @datum          char(8) = '20070501',
   @abteilungID    int  = 1,
   @terminid       int  = 1
--   @rgbin          varchar(32) = '00000000'
)
as
begin
  set nocount on

--   delete from terminplan where planterminid = @planterminid
   insert into Terminplan (PlanTerminID, PlanID, PrsID, Datum, AbteilungID, TerminID, Name) values (@planterminid, @planID, @prsID, @datum, @abteilungID, @terminid, @name)


end

go
print 'Procedure: set_terminplan done ...'
go
grant exec on set_terminplan to prsadmins with grant option
go
grant exec on set_terminplan to prsusers
go

